Imports Microsoft.VisualBasic.CompilerServices
Imports System.Web.SessionState
Imports StartFrame.Web.BR
Imports System
Imports System.Collections.Specialized
Imports System.Web

Namespace Handlers
    Public Class LoginHandler
        Implements IHttpHandler, IRequiresSessionState

        Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
            Get
                Return False
            End Get
        End Property

        Public Sub ProcessRequest(context As HttpContext) Implements IHttpHandler.ProcessRequest
            Dim nameValueCollection As NameValueCollection = New NameValueCollection()
            Dim login As Login = New Login()
            nameValueCollection.Add(context.Request.QueryString)
            nameValueCollection.Add(context.Request.Form)
            context.Response.ContentType = "text/plain"
            Try
                If Common.Env.GetConfigValue("useIdentity") = True Then
                    context.Response.Write(login.Login(nameValueCollection("action"), nameValueCollection("usuario"), "INTEGRADA", Nothing, Nothing))
                    Exit Sub
                End If
            Catch
            End Try
            context.Response.Write(login.Login(nameValueCollection("action"), nameValueCollection("usuario"), nameValueCollection("password"), nameValueCollection("newpassword"), nameValueCollection("newrepeatpassword")))
        End Sub
    End Class
End Namespace
